package form;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

import trangchu.UtilDelegate;

public class DSJ_KhoHang {
	public String MaK;
	public String TenKho;
	public String DiaChi;
	public String DienThoai;
	public String LienHe;
	public String getMaK() {
		return MaK;
	}
	public void setMaK(String maK) {
		MaK = maK;
	}
	public String getTenKho() {
		return TenKho;
	}
	public void setTenKho(String tenKho) {
		TenKho = tenKho;
	}
	public String getDiaChi() {
		return DiaChi;
	}
	public void setDiaChi(String diaChi) {
		DiaChi = diaChi;
	}
	public String getDienThoai() {
		return DienThoai;
	}
	public void setDienThoai(String dienThoai) {
		DienThoai = dienThoai;
	}
	public String getLienHe() {
		return LienHe;
	}
	public void setLienHe(String lienHe) {
		LienHe = lienHe;
	}
	
	public Vector<DSJ_KhoHang> getUsers(){
		Vector<DSJ_KhoHang> getKhoHang = new Vector<DSJ_KhoHang>();
		Connection con =UtilDelegate.getConnection();		
		PreparedStatement st;
		try {
			st = con.prepareStatement("select * from DiaChiKho");
			ResultSet rs = st.executeQuery();
			while(rs.next()){
				
				String maK= rs.getString("MaK");
				String tenKho = rs.getString("TenKho");
				String diaChi = rs.getString("DiaChi");				
				String dienThoai = rs.getString("DienThoai");
				String lienHe = rs.getString("LienHe");
				
				DSJ_KhoHang b = new DSJ_KhoHang();
				b.setMaK(maK);
				b.setTenKho(tenKho);
				b.setDiaChi(diaChi);
				b.setDienThoai(dienThoai);				
				b.setLienHe(lienHe);
				
				getKhoHang.add(b);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return getKhoHang;
	}
	
	
}
